<?php
class Admin_Model_Index extends Zend_Db_Table_Abstract{
	protected $_name='tblcategories';
	
	public function getCategories(){
		$sql = $this->_db->select()
                         ->from($this->_name)
                         ->where('1=1');
        return $this->_db->fetchAll($sql);
	}
	
	public function getComponents(){
		$sql = $this->_db->select()
                         ->from('tblcomponent')
                         ->where('1=1');
        return $this->_db->fetchAll($sql);
	}
	
	/*
	*@auth: vuhai4187
	*@date 31.10.2011
	*@return string
	*/
	public function getPost(){
		$sql = $this->_db->select()
						 ->from('tblpost')
						 ->where('1=1');
		return $this->_db->fetchAll($sql);
	}
	
	/*
	*@auth: vuhai4187
	*@date 31.10.2011
	*@return string
	*/
	public function getAdmin(){
		$sql = $this->_db->select()
						 ->from('tbladmin')
						 ->where('1=1');
		return $this->_db->fetchAll($sql);
	}
	
	/*
	*@auth: vuhai4187
	*@date 31.10.2011
	*@return string
	*/
	public function getComment(){
		$sql = $this->_db->select()
						 ->from('tblcomment')
						 ->where('1=1');
		return $this->_db->fetchAll($sql);
	}
	
	/*
	*@auth: vuhai4187
	*@date 31.10.2011
	*@return string
	*/
	public function getCustomer(){
		$sql = $this->_db->select()
						 ->from('tblcustomer')
						 ->where('1=1');
		return $this->_db->fetchAll($sql);
	}
	
	/*
	*@auth: vuhai4187
	*@date 31.10.2011
	*@return string
	*/
	public function getFile(){
		$sql = $this->_db->select()
						 ->from('tblfile')
						 ->where('1=1');
		return $this->_db->fetchAll($sql);
	}
	
	/*
	* @auth: vuhai4187
	* @date: 01.11.2011
	* @return 
	*/
	public function getFeaturedPost(){
		$sql = $this->_db->select()
						 ->from(array('p'=>'tblpost'))
                         ->join(array('a'=>'tbladmin'),'p.adm_id=a.adm_id','adm_fullname')
						 ->where('1=1')
						 ->limit(4);
		//echo '<pre>'; print_r($sql); echo '</pre>';
		 return $this->_db->fetchAll($sql);
	}
}